<template>
  <div class="">
    <header>
      <div>
        <span>TODOLIST</span>
        <input
          type="text"
          placeholder="添加toDo"
          v-model="inputVal"
          id="iptVal"
          @keydown.enter="add"
        />
      </div>
    </header>
  </div>
</template>

<script>
export default {
  data() {
    return {
      inputVal: "",
    };
  },
  created() {},
  methods: {
    add() {
      this.$emit("add", this.inputVal);
      this.inputVal = '';
    },
  },
  components: {},
};
</script>

<style lang='scss'>
header {
  width: 100%;
  height: 50px;
  background-color: #444;
}

header div {
  width: 600px;
  margin: 0 auto;
  height: 100%;
  /* 将元素盒转化为弹性盒子 */
  display: flex;
  /* 
            justify-content 主轴方向上的对齐方式
            space-between 两边对齐 中间留白
             */
  justify-content: space-between;
  /* 侧轴的对齐方式 */
  align-items: center;
  color: #fff;
}

header div span {
  font-size: 30px;
  font-weight: bold;
}

header div input {
  outline: none;
  border: none;
  width: 300px;
  height: 30px;
  padding-left: 15px;
  border-radius: 6px;
}
</style>
